package com.king.zxing.app.domain;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

public class User implements Parcelable {
    public final long id;
    public final String username;
    private String phoneNumber;
    public final String userPassword;
    private long points;
    private long avatarID;
    private long lastSignInTime;
    private int consecutiveSignInCount;


    public User(long id, String username, String phoneNumber, String userPassword, long points, long avatarID, long lastSignInTime, int consecutiveSignInCount) {
        this.id = id;
        this.username = username;
        this.phoneNumber = phoneNumber;
        this.userPassword = userPassword;
        this.points = points;
        this.avatarID = avatarID;
        this.lastSignInTime = lastSignInTime;
        this.consecutiveSignInCount = consecutiveSignInCount;
    }


    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public long getPoints() {
        return points;
    }

    public void setPoints(long points) {
        this.points = points;
    }

    public long getAvatarID() {
        return avatarID;
    }

    public void setAvatarID(long avatarID) {
        this.avatarID = avatarID;
    }

    public long getLastSignInTime() {
        return lastSignInTime;
    }

    public void setLastSignInTime(long lastSignInTime) {
        this.lastSignInTime = lastSignInTime;
    }

    public int getConsecutiveSignInCount() {
        return consecutiveSignInCount;
    }

    public void setConsecutiveSignInCount(int consecutiveSignInCount) {
        this.consecutiveSignInCount = consecutiveSignInCount;
    }


    protected User(Parcel in) {
        id = in.readLong();
        username = in.readString();
        phoneNumber = in.readString();
        userPassword = in.readString();
        points = in.readLong();
        avatarID = in.readLong();
        lastSignInTime = in.readLong();
        consecutiveSignInCount = in.readInt();
    }

    public static final Creator<User> CREATOR = new Creator<User>() {
        @Override
        public User createFromParcel(Parcel in) {
            return new User(in);
        }

        @Override
        public User[] newArray(int size) {
            return new User[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeLong(id);
        dest.writeString(username);
        dest.writeString(phoneNumber);
        dest.writeString(userPassword);
        dest.writeLong(points);
        dest.writeLong(avatarID);
        dest.writeLong(lastSignInTime);
        dest.writeInt(consecutiveSignInCount);
    }
}

